<extend name="./public/frame.html"/>
<block name="content">
    <div class="layui-collapse" lay-filter="driver">
        <div class="layui-colla-item">
            <h2 class="layui-colla-title" data-v="driver">个人基本信息</h2>
            <div class="layui-colla-content layui-show">
                <table class="layui-table">
                    <volist name="fields" id="field">
                        <tr>
                            <td  style="width: 10%">{$field}</td>
                            <if condition="in_array($key,$img)">
                                <empty name="info[$key]">
                                    <td>{$info['driver_name']}{$field}</td>
                                    <else/>
                                    <php>$thumb = $key.'_thumb';</php>
                                    <td class="layer-photos-demo">
                                        <img layer-src="{$info[$key]}" alt="{$info['driver_name']}{$field}" src="{$info[$thumb]?:$info[$key]}">
                                    </td>
                                </empty>
                                <elseif condition="$key eq auth_type"/>
                                <td>{$auth_type[$info[$key]]}</td>
                                <elseif condition="$key eq work_province"/>
                                <td>{$info['province']}{$info['city']}{$info['county']}</td>
                                <elseif condition="$key eq driver_avatar"/>
                                <empty name="info[$key]">
                                    <td><span>{$info['driver_name']}{$field}</span>{$tip}</td>
                                    <else/>
                                    <php>$thumb = $key.'_thumb';</php>
                                    <td class="layer-photos-demo">
                                        <img layer-src="{$info[$key]}" alt="{$info['driver_name']}{$field}" src="{$info[$thumb]?:$info[$key]}">{$tip}
                                    </td>
                                </empty>
                                <else/>
                                <td>{$info[$key]|default="0"}</td>
                            </if>
                        </tr>
                    </volist>
                </table>
            </div>
        </div>
        <div class="layui-colla-item">
            <h2 class="layui-colla-title"  data-v="car" data-value="{$info['driver_id']}" data-act="no">车辆基本信息</h2>
            <div class="layui-colla-content">

            </div>
        </div>
        <div class="layui-colla-item">
            <h2 class="layui-colla-title"  data-v="auth" data-value="{$info['driver_id']}" data-act="no">司机审核信息</h2>
            <div class="layui-colla-content">

            </div>
        </div>
    </div>

    <script>
        layui.use(['layer','element'], function(){
            var layer = layui.layer;
            var element = layui.element;
            layer.photos({
                photos: '.layer-photos-demo'
                ,anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
                ,tab: function(pic, layero){
                    var str = "<div style='text-align: center'>"+pic.alt+"</div>";
                    layero.prepend(str);
                }
            });
            var $ = layui.jquery;
            element.on('collapse(driver)', function(data){
                var title = data.title;
                switch (title.data('v')){
                    case 'car':
                        if(title.data('act')=='no'){
                            title.data('act','yes');
                            $.post('/admin/driver/carInfo',{driver_id:title.data('value')},function (res) {
                                switch (res['status']){
                                    case 1:
                                        data.content.html(res['html']);
                                        break;
                                    default:
                                        layer.alert(res['msg'],{icon: 5});
                                        break;
                                }
                            },'json')
                        }
                        break;
                    case 'auth':
                        if(title.data('act')=='no'){
                            title.data('act','yes');
                            $.post('/admin/driver/authInfo',{driver_id:title.data('value')},function (res) {
                                switch (res['status']){
                                    case 1:
                                        data.content.html(res['html']);
                                        break;
                                    default:
                                        layer.alert(res['msg'],{icon: 5});
                                        break;
                                }
                            },'json')
                        }
                    default:
                        break;
                }
            });
        });
    </script>
</block>